<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
	<title>通过DsBridge js  调用Android代码 </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=0.5,user-scalable=no"/>
    <!--require dsbridge init js-->
    <script src="https://unpkg.com/dsbridge/dist/dsbridge.js"> </script>

</head>

<style>
    .btn {
        text-align: center;
        background: #d8d8d8;
        color: #222;
        padding: 20px;
        margin: 30px;
        font-size: 24px;
        border-radius: 4px;
        box-shadow: 4px 2px 10px #999;
    }

    .btn:active {
        opacity: .7;
        box-shadow: 4px 2px 10px #555;
    }
</style>
<body>
   <script type="text/javascript">

       function callSyn(){
       	    //第一参数：是方法名 第二参数：传的值
       	    alert(dsBridge.call("testSyn", "同步调用"));
       	    // alert(dsBridge.call("testNoArgSyn",""))
       }

      // function callASyn(){
      //  	    //第一参数：是方法名 第二参数：传的值
      //  	    alert(dsBridge.call("testAsyn", "异步调用"));
      //  }
       

       function callNoArgSyn(){
       }

       function callAsyn() {
          dsBridge.call("testAsyn","Eric ", function (v) {
              alert(v);
           });
       }

       function echoSyn() {
          // call function with namespace
           var ret = dsBridge.call("echo.syn",{msg:" I am echoSyn call", tag:1});
           alert(JSON.stringify(ret))
       }   

       

       // function callAsyn("testAsyn",""){

       // }


   </script>

   <button  class="btn" type="button" onclick="callSyn()">Synchronous call</button>
   <br></br>
   <button  class="btn" type="button" onclick="callAsyn()">异步调用</button>
   <br></br>
   <button  class="btn" type="button" onclick="echoSyn()">echo 同步调用</button>
   <br></br>



</body>
</html>




